<?php

/*
 * Edit by shengxin
 * Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/PHPClass.php to edit this template
 */

namespace app\admin\controller;

use cmf\controller\AdminBaseController;

/**
 * Description of SystemCfgController
 *
 * @author PC
 */
class SystemCfgController extends AdminBaseController{
    
    public function index(){
        $config = cmf_get_option('res_config');
        if(empty($config)){
            $config = [
                'res'=>1,'abb'=>1
            ];
        }
        $this->assign('config',$config);
        return $this->fetch();
    }
    
    public function save(){
        $post = $this->request->post();
        $save = [];
        foreach ($post as $key=>$val){
            $key = filter_var($key, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
            $save[$key] = filter_var($val, FILTER_SANITIZE_FULL_SPECIAL_CHARS);
        }
        cmf_set_option('res_config',$save);
        $this->success('ok');
    }
}
